package Test;
use strict;
use warnings;

my $enabled = 0;
my $site_address = 'www.test.ru';


sub explore{
 my ( $self, $c ) = @_;
 return 1 if !$enabled;
 $c->debug_call("call explore conf=".$c->conf('user_agent')."\n");
 
 my $news = {
    site => $site_address,
    id => undef,
    url => undef,
    small_text => undef,
 };
 for my $id (1..5){

    $news->{ id } = $id;
    $news->{ url } = "$site_address/test/$id";
    $news->{ small_text } = "test text test text for your test $id $id $id test ";
    
    # set_news() return 0-after error, 1-after insert news, 2-if news already exist
    $c->set_news( $news ) or $self->{error} = "Error while call set_news() (". __FILE__." line ".__LINE__."):\n ".$c->error(), return 0 ;
    
 } 
 
 return 1;
}

sub new{
 my $package = shift;
 my $self = {
    site_address => $site_address,
    
 };
 return bless $self;
}

sub error{ shift->{error} }

sub enabled{ return $enabled }

1;
